package com.yuanjin.util;

import java.util.StringTokenizer;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 字符工具
 * 
 * @author zhan414
 * 
 */
public class MyWordUtils {

	/**
	 * @param inputString
	 * @return
	 * @常用规则： [\\u4E00-\\u9FA5\\uF900-\\uFA2D] -->匹配汉字
	 */
	public static String TimeCheck(String inputString) {
		// 2015年8月23日12时12分
		String ruleString = "^\\d{4}[\\u4E00-\\u9FA5\\uF900-\\uFA2D]{1}";
		Pattern p = Pattern.compile(ruleString);
		Matcher m = p.matcher(inputString);
		return null;
	}

	/**
	 * subString-字符串分割
	 * 
	 * @param inputString
	 *            待分解字符串
	 * @param ruleString
	 *            分解规则
	 * @return Vector 分割后字符串数组
	 * @eg:inputString="asdasd_=123+123",ruleString="_+=" -->
	 *                                                    output="asdasd"、"123"
	 *                                                    、"123"
	 * 
	 */
	public static Vector<String> subString(String inputString, String ruleString) {
		Vector<String> vector = null;
		StringTokenizer token = new StringTokenizer(inputString, ruleString);
		while (token.hasMoreTokens()) {
			vector.add(token.nextToken());

		}
		return vector;
	}
}
